home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
language
/
embedded
/
develop
/
libsrc11.arc
/
PROLOG.S
< prev
next >
Wrap
Text File
|
1989-04-27
|
2KB
|
58 lines
******************************************************************************
* prolog.s 3.1 11/12/84
*
* 68HC11 CROSS C COMPILER RUN-TIME LIBRARY
*
* (c) Copyright 1984, Motorola, Inc.
*
* FUNCTION NAME: .prolog
*
* ACTION: Allocate the stack frame for a C function.
* Initialize the frame pointer, X.
*
* REGISTERS AND STACK:
*
* ON ENTRY: X: Old FP (frame pointer)
*
* STACK: Incoming Arguments
* Return Address to C caller
* SP: Return Address to C callee (Ptr to in-line constants):
* fdb frame_size
* fdb fp_offset (250 - SIZEOF(incoming args))
*
* ON EXIT: X: New FP (256 bytes below furthest argument)
*
* STACK: Incoming Arguments
* Return Address to C caller (2 bytes)
* Old FP (2 bytes)
* New FP-256 (2 bytes)
* SP: Local Variables (frame_size bytes)
*
* NOTES: New FP may be above or below the SP, depending upon the size
* of the frame.
*
* Returns to first instruction following the in-line constants.
*
******************************************************************************
psct
xdef .prolog
.prolog:
puly ptr to in-line args
pshx save old FP
pshx space for new FP-256
tsx copy SP to X
pshx ...and D
pula
pulb
subd 2,%y new FP = old SP - fpoffset
deca ...- 256
std 0,%x store FP-256
inca restore new FP
xgdx FP in X. SP in D.
subd 0,%y new SP = old SP - framesize
xgdx FP is temporarily undone...
txs SP done
xgdx FP restored.
jmp 4,%y return.
end